Listing D.9. Plik Olimpiady.xsl
<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <xsl:key name="identyfikator" match="zawodnik" use="@ident"/>
  
  <xsl:template match="/">

    <html>
      <head>
        <title>Medalici Olimpijscy</title>
      </head>
      <body bgcolor="gray" vlink="blue" alink="blue" link="blue">
        <font color="black">
          <h1>Igrzyska Olimpijskie <xsl:value-of select="igrzyskaOlimpijskie/@miasto"/>
            <xsl:value-of select="igrzyskaOlimpijskie/@rok"/>
          </h1>
        </font>
        <xsl:apply-templates select="igrzyskaOlimpijskie/dyscyplina/pe/konkurencja"/>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template match="konkurencja">
    <b>
      <font color="black" size="5">
       Dyscyplina: <xsl:value-of select="../../@nazwa"/>
      </font>
      <br/>
      <font color="black" size="4">
       Konkurencja: <xsl:value-of select="@nazwa"/>
      </font>
      <br/>
      <font color="black" size="3">
      Pe: <xsl:value-of select="../@nazwa"/>
      </font>
      <br/>
    </b>
    <p/><b>
    <table border="0" cellspacing="10" cellpadding="10" bgcolor="white" width="100%" >
      <tr><td><hr/><xsl:choose>
      <xsl:when test="count(zoto) = 1">
        Zoty medal: 
      </xsl:when>
      <xsl:when test="count(zoto)=0">
        W tej konkurencji nie rozdano adnego zotego medalu.
      </xsl:when>
      <xsl:otherwise>
        Zote medale: 
      </xsl:otherwise>
      </xsl:choose></td>
      <xsl:apply-templates select="zoto"/>
      </tr>
      <tr><td><hr/><xsl:choose>
      <xsl:when test="count(srebro) = 1">
        Srebrny medal: 
      </xsl:when>
      <xsl:when test="count(srebro)=0">
        W tej konkurencji nie rozdano adnego srebrnego medalu.
      </xsl:when>
      <xsl:otherwise>
        Srebrne medale: 
      </xsl:otherwise>
      </xsl:choose></td>
      <xsl:apply-templates select="srebro"/>
      </tr>
      <tr><td><hr/><xsl:choose>
      <xsl:when test="count(brz) = 1">
        Brzowy medal: 
      </xsl:when>
      <xsl:when test="count(brz)=0">
        W tej konkurencji nie rozdano adnego brzowego medalu.
      </xsl:when>
      <xsl:otherwise>
        Brzowe medale: 
      </xsl:otherwise>
      </xsl:choose></td>
      <xsl:apply-templates select="brz"/>
      </tr>
    </table>
    </b>
  </xsl:template>
  
  <xsl:template match="zoto">
    <td align="left" >
      <font color="orange">
        <xsl:variable name="key" select="key('identyfikator',@ident)"/>
        <xsl:for-each select="$key">
          <br>
            <b><font size="+2">
            <xsl:value-of select="nazwisko"/>
            </font>
            </b>
          </br>
          <br>
            <xsl:value-of select="pastwo"/>
            </br>
          </xsl:for-each>
          <br>
            <xsl:value-of select="wynik"/>
          </br>
        </font>
      </td>
      <xsl:for-each select="$key">
        <xsl:if test="zdjcie">
          <td align="left">
            <img>
              <xsl:attribute name="src"><xsl:value-of select="zdjcie/@nazwaPliku"/></xsl:attribute>
              <xsl:attribute name="alt"><xsl:value-of 
select="zdjcie/@alternatywnyTekst"/></xsl:attribute>
            </img>
          </td>
        </xsl:if>
      </xsl:for-each>
      <xsl:variable name="key2" select="key('identyfikator',@ident)/witryna"/>
      <td align="left">
        <xsl:for-each select="$key2">
      
          <xsl:if test=".">
          
          <a>
            <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
            <xsl:value-of select="."/>
          </a>
          </xsl:if>
          <br/>
        </xsl:for-each>
      </td>
  </xsl:template>
  
  <xsl:template match="srebro">
      <td align="left">
      
        <font color="#303030">
          <xsl:variable name="key" select="key('identyfikator',@ident)"/>
          <xsl:for-each select="$key">
            <br><b><font size="+1">

              <xsl:value-of select="nazwisko"/>
              </font></b>
            </br>
            <br>
              <xsl:value-of select="pastwo"/>
            </br>
          </xsl:for-each>
          <br>
            <xsl:value-of select="wynik"/>
          </br>
        </font>
      </td>

  </xsl:template>
  
  <xsl:template match="brz">
    <td align="left">
        <font color="bronze">
          <xsl:variable name="key" select="key('identyfikator',@ident)"/>
          <xsl:for-each select="$key">
            <br>
              <b><font size="+1">
              <xsl:value-of select="nazwisko"/>
              </font></b>
            </br>
            <br>
              <xsl:value-of select="pastwo"/>
            </br>
          </xsl:for-each>
          <br>
            <xsl:value-of select="wynik"/>
          </br>
        </font>
      </td>
    </xsl:template>
  
</xsl:stylesheet>
